﻿<%@ Page Title="Planning" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Iterations.aspx.cs" Inherits="APMAWebConsole.PlanningPart.Iterations" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Iterations
    </h2>

    <asp:Button ID="btnAddIteration" runat="server" Text="Add Iteration" OnCommand="OnButtonCommand" CommandName="Add"/>
    <asp:Button ID="btnRemoveIteration" runat="server" Text="Remove Iteration" OnCommand="OnButtonCommand" CommandName="Remove" Visible="false"/>
    <asp:Button ID="btnEditIteration" runat="server" Text="Edit Iteration" OnCommand="OnButtonCommand" CommandName="Edit" Visible="false"/>
    <asp:Button ID="btnViewIteration" runat="server" Text="View Iteration" OnCommand="OnButtonCommand" CommandName="View" Visible="false"/>
    <asp:Button ID="btnBackToList" runat="server" Text="Back to Iteration List" OnCommand="OnButtonCommand" CommandName="BackToList" CausesValidation="False"/>
        
    <div id="divIterationsGrid" runat="server">
        <p>
            <asp:Label ID="lblSelectedIteration" runat="server" AssociatedControlID="txtSelectedIteration" Text="Selected Iteration ID:" Visible="false"/>
            <asp:TextBox ID="txtSelectedIteration" runat="server" CssClass="textEntry" Text="0" Visible="false"/>
        </p>
        <asp:GridView ID="grdIterations" runat="server" AutoGenerateColumns="false">
            <columns>
                <asp:BoundField HeaderText="ID" DataField="Id" />
                
                <asp:TemplateField HeaderText="" ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="btnEdit" runat="server" CausesValidation="false" Text="Edit" OnCommand="OnButtonCommand" CommandName="Select" CommandArgument='<%# Container.DataItemIndex + 1 %>'/>
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:TemplateField HeaderText="" ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="btnView" runat="server" CausesValidation="false" Text="View" OnCommand="OnButtonCommand" CommandName="View" CommandArgument='<%# Container.DataItemIndex + 1 %>'/>
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:TemplateField HeaderText="" ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="btnRemove" runat="server" CausesValidation="false" Text="X" OnCommand="OnButtonCommand" CommandName="Remove" CommandArgument='<%# Container.DataItemIndex + 1 %>'/>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:BoundField HeaderText="Project" DataField="Project" />
                <asp:BoundField HeaderText="Start Date" DataField="Start_date" />
                <asp:BoundField HeaderText="End Date" DataField="End_date" />
                <asp:BoundField HeaderText="State" DataField="State" />
                <asp:BoundField HeaderText="Plan Estimate" DataField="Plan_Estimate" />
                <asp:BoundField HeaderText="Release" DataField="Release_id" />
            </columns>
        </asp:GridView>
    </div>
        
    <div id="divEditMode" runat="server">
        <p>
            <asp:Label ID="lblIterationId" runat="server" AssociatedControlID="txtIterationId">ID:</asp:Label>
            <asp:TextBox ID="txtIterationId" runat="server" CssClass="textEntry"></asp:TextBox>
        </p>
        <p>
            <asp:Label ID="lblIterationProjectId" runat="server" AssociatedControlID="ddlIterationProjectId">Project:</asp:Label>
            <asp:DropDownList ID="ddlIterationProjectId" runat="server" />
            <asp:RequiredFieldValidator id="rfvIterationProjectId" runat="server"
                                        ControlToValidate="ddlIterationProjectId"
                                        ErrorMessage=" * Iteration Project is a required field."
                                        ForeColor="Red"/>
        </p>
        <p>
            <asp:Label ID="lblIterationStartDate" runat="server" AssociatedControlID="txtIterationStartDate">Start Date:</asp:Label>
            <asp:TextBox ID="txtIterationStartDate" runat="server" />
            <asp:RequiredFieldValidator id="rfvIterationStartDate" runat="server"
                                        ControlToValidate="txtIterationStartDate"
                                        ErrorMessage=" * Iteration Start Date is a required field."
                                        ForeColor="Red"/>
            <br/>
            <asp:CompareValidator id="cvIterationStartDate" runat="server" Type="Date" Operator="DataTypeCheck" 
            ControlToValidate="txtIterationStartDate" ErrorMessage="Please enter a valid date.">
            </asp:CompareValidator>
        </p>
        <p>
            <asp:Label ID="lblIterationEndDate" runat="server" AssociatedControlID="txtIterationEndDate">End Date:</asp:Label>
            <asp:TextBox ID="txtIterationEndDate" runat="server" />
            <br/>
            <asp:CompareValidator id="cvIterationEndDate" runat="server" Type="Date" Operator="DataTypeCheck" 
            ControlToValidate="txtIterationEndDate" ErrorMessage="Please enter a valid date.">
            </asp:CompareValidator>
        </p>
        <p>
            <asp:Label ID="lblIterationStateId" runat="server" AssociatedControlID="ddlIterationStateId">State:</asp:Label>
            <asp:DropDownList ID="ddlIterationStateId" runat="server" />
            <asp:RequiredFieldValidator id="rfvIterationStateId" runat="server"
                                        ControlToValidate="ddlIterationStateId"
                                        ErrorMessage=" * Iteration state is a required field."
                                        ForeColor="Red"/>
        </p>
        <p>
            <asp:Label ID="lblIterationPlanEstimate" runat="server" AssociatedControlID="txtIterationPlanEstimate">Plan estimate:</asp:Label>
            <asp:TextBox ID="txtIterationPlanEstimate" runat="server" CssClass="textEntry"></asp:TextBox>
            <br/>
            <asp:RangeValidator id="revIterationPlanEstimate" runat="server"
                                        ControlToValidate="txtIterationPlanEstimate"
                                        MinimumValue="0"
                                        MaximumValue="2147483647"
                                        Type="Integer"
                                        Text="Iteration Plan estimate must be integer and greater or equal than 0"/>
        </p>
        <p>
            <asp:Label ID="lblIterationReleaseId" runat="server" AssociatedControlID="ddlIterationReleaseId">Release ID:</asp:Label>
            <asp:DropDownList ID="ddlIterationReleaseId" runat="server" />
        </p>
        <asp:Button ID="btnCreateUpdate" runat="server" Text="Save" OnCommand="OnButtonCommand" CommandName="SaveUpdate"/>

        <asp:GridView ID="grdUserStories" runat="server" AutoGenerateColumns="false" Visible="false">
            <columns>
                <asp:BoundField HeaderText="ID" DataField="Id" />
                <asp:BoundField HeaderText="Name" DataField="Name" />
                <asp:BoundField HeaderText="Owner" DataField="Owner" />
                <asp:BoundField HeaderText="Project" DataField="Project" />
                <asp:BoundField HeaderText="Description" DataField="Description" />
                <asp:BoundField HeaderText="State" DataField="State" />
                <asp:BoundField HeaderText="Estimate" DataField="Estimate" />
                <asp:BoundField HeaderText="Actuals" DataField="Actuals" />
                <asp:BoundField HeaderText="TO DO" DataField="To_do" />
                <asp:BoundField HeaderText="Plan Estimate" DataField="Plan_Estimate" />
                <asp:BoundField HeaderText="Notes" DataField="Notes" />
            </columns>
        </asp:GridView>
    </div>
</asp:Content>
